<template>
    <div>
        <img :src="mymig" width="150" height="150" class="rounded-corners img-fluid">
        <br>
        {{info.name}}
        <br>
        {{info.price}}
        <br>
        颜色:{{ param.color }}

    </div>
</template>

<script>
export default {
    data () {
        return {
            //商品id
            id:'',
            //商品介绍
            info:[],
            //商品规格(难点)
            param:{},
            //图片名字
            mymig:''
        }
    },
    methods: {
        get_goods(){
            this.axios.get('http://127.0.0.1:8000/weekgood/',{params:{id:this.id}})
            .then(a=>{
                this.info=a.data.msg
                //将商品规格由字符串样式的json转化 json,展示的时候 点 出来就可了
                this.param = JSON.parse(a.data.msg.params)
                console.log('转化结果',this.param)
                this.mymig = 'http://localhost:8000/static/upload/'+a.data.msg.img


                console.log(a)
            })
        }
        
    },
    created () {
        //接受商品id
        this.id = this.$route.query.id
        // console.log('跳转凭证',this.id)
        this.get_goods()
        
    }

}
</script>

<style>

</style>
